package logic;

import java.io.Serializable;

import logic.Template.TemplateRow;

public class TemplateEntry implements Serializable, Entry  {
	/**
	 * 
	 */
	private static final long serialVersionUID = -7205337319112649705L;
	
	private String label="";
	private Type type = new Type(Type.STRING);
	private int id = 0;
	transient private TemplateRow tr; 
	
	public TemplateEntry() {
	}
	
	public TemplateEntry(TemplateRow templateRow) {
		tr = templateRow;
	}

	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	public void removeFromParent() {
		tr.removeEnrty(this);
	}

	public void setTr(TemplateRow tr) {
		this.tr = tr;
	}

	public TemplateRow getTr() {
		return tr;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public Type getType() {
		return type;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public Object getValue() {
		// TODO Auto-generated method stub
		return null;
	}

	public void setValue(Object o) {
		// TODO Auto-generated method stub

	}

	@Override
	public int hashCode() {
		return id << 4 | getType().ordinal();
	}

	@Override
	public boolean equals(Object obj) {
		return (((TemplateEntry) obj).id << 4 | ((TemplateEntry) obj).getType().ordinal()) == (id << 4 | getType()
				.ordinal());
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return getLabel();
	}
}
